import java.util.Timer;
import java.util.TimerTask;

public class Test1 {
    public static void main(String[] args) {
        Timer timer = new Timer();

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("2000时间到执行任务");
            }
        },   2000  ) ;
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("3000时间到,执行任务");
            }
        } , 3000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("1000时间到,执行任务");
            }
        } , 1000);
        System.out.println("计时器开始执行");

    }
}
